package com.ipudong.widget.recycleview;

import android.content.Context;
import android.graphics.Rect;
import android.support.v7.widget.RecyclerView;
import android.util.TypedValue;
import android.view.View;

public class SpaceItemDecoration extends RecyclerView.ItemDecoration {
	private int space;

	public SpaceItemDecoration (Context context) {
		space = (int) TypedValue.applyDimension (TypedValue.COMPLEX_UNIT_DIP, 15f, context.
				getResources ().getDisplayMetrics ());
	}

	@Override
	public void getItemOffsets (Rect outRect, View view, RecyclerView parent, RecyclerView.State state) {
		super.getItemOffsets (outRect, view, parent, state);
		outRect.top += space;
		outRect.bottom += space;
		outRect.left += space;
		outRect.right += space;
	}
}
